<template>
  <div class="setNickname">
    <ReturnBack></ReturnBack>
    <van-field
      v-model="value"
      label="昵称"
      input-align="right"
    @change="changetest" />
    <div style="margin:20px">
      <van-button round block type="info" native-type="submit" style="background-color:red;border:none; border-radius: 0" @click="onSubmit">确认</van-button>
    </div>
  </div>
</template>

<script>
import ReturnBack from '@/components/return.vue'
export default {
  name: 'SetNickname',
  data () {
    return {
      value: ''
    }
  },
  components: {
    ReturnBack
  },
  methods: {
    changetest (value) {
      console.log(value.srcElement._value)
    },
    onSubmit () {
      window.localStorage.setItem('username', this.value)
      this.$router.push('/me/information')
    }
  },
  mounted () {
    this.value = window.localStorage.getItem('username')
  }
}
</script>

<style>

</style>
